package com.jinlejia.erp.base;

import com.alibaba.fastjson.JSON;
import com.zhy.http.okhttp.callback.Callback;

import java.io.IOException;
import java.util.Map;

import okhttp3.Response;

/**
 * Json to map<String,Object>
 */
public abstract class MapCallBack extends Callback<Map<String, Object>> {
    @Override
    public Map<String, Object> parseNetworkResponse(Response response, int id) throws IOException {

        String json = response.body().string();
        //JSON -> Map
        Map<String,Object> map1 = (Map<String,Object>)JSON.parse(json);
        return map1;
    }

}
